package com.dreamo.pache.test;

import java.io.ByteArrayInputStream;

import android.text.format.Time;

import com.dreamo.pache.data.ITicket;
import com.google.android.gms.maps.model.LatLng;

public class MockTicket extends ITicket {
    
    
    /*
     * By default MockTicket gives current time + 10s.
     * default location is at Union Sq.
     */
    public MockTicket()
    {
        Time now = new Time();
        now.setToNow();
        
        time = new Time();
        time.set(now.second + 10, now.minute, now.hour, now.monthDay, now.month, now.year);
        
        expired = false;
        secondsElapsed = 0;
        Location = new LatLng(40.735863,-73.991083);
    }
    
    
    public MockTicket (byte [] bytes) {
        ByteArrayInputStream in = new ByteArrayInputStream (bytes);
        int seconds = in.read();
        int minute = in.read();
        int hour = in.read();
        int monthDay = in.read();
        int month= in.read();
        int year = in.read();
        time = new Time();
        time.set(seconds, minute, hour, monthDay, month, year);
        
        expired = in.read() == 1 ? true : false;
        secondsElapsed = in.read();
    }


}
